package com.xmy.cultivate.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.cultivate.entity.Quarter;
import com.xmy.cultivate.entity.RadeFiducial;
import com.xmy.cultivate.entity.RadeFiducialSet;
import com.xmy.cultivate.entity.response.LackRecourseRate;
import com.xmy.cultivate.service.IRadeFiducialSetService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.PageResult;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 需要统计基准值的率 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2025-04-26
 */
@RestController
@RequestMapping("/api/radeFiducialSet")
public class RadeFiducialSetController extends BaseController {

    @Autowired
    IRadeFiducialSetService iRadeFiducialSetService;

    @GetMapping("")
    public Result getRadeFiducialSetList(@RequestParam(value = "yearPart", required = true) Integer yearPart,
                                         @RequestParam(value = "quarterNum", required = true) Integer quarterNum) {

        QueryWrapper<RadeFiducialSet> radeFiducialSetQueryWrapper = new QueryWrapper<>();
        radeFiducialSetQueryWrapper.eq("status", 1);
        radeFiducialSetQueryWrapper.eq("year_part", yearPart);
        radeFiducialSetQueryWrapper.eq("quarter_num", quarterNum);

        List<RadeFiducialSet> radeFiducialSetList = iRadeFiducialSetService.list(radeFiducialSetQueryWrapper);

        return new Result(Code.OK, radeFiducialSetList, Code.GET_OK_MSG);
    }

}
